import QtQuick 2.0
import QtQuick.Controls 2.5
import QtQuick.Layouts 1.3
import SvgImage 1.0

Rectangle {
    id: topRect
    color: "transparent"
    property string _text
    property var _view
    property bool checked: _view.selected_all
    property url source_all_unselect_normal: "qrc:/image/check_all_normal.svg"
    property url source_all_selected_normal: "qrc:/image/check_all_select_normal.svg"

    RowLayout {
        anchors.fill: parent
        spacing: 6

        Rectangle {
            id: selectAllCheckBox
            implicitWidth: 18
            implicitHeight: 18
            property bool checked: _view.selected_all

            SvgImage {
                id: indicatorImage
                anchors.fill: parent
                source: selectAllCheckBox.checked ? source_all_selected_normal : source_all_unselect_normal
            }

            MouseArea {
                anchors.fill: parent
                hoverEnabled: true
                onClicked: {
                    selectAllCheckBox.checked = !selectAllCheckBox.checked
                    _view.selectedAll(selectAllCheckBox.checked)
                }
            }
        }

        CusText {
            id: printerNameText
            text: _text
            color: Theme.text_color
            font.pixelSize: Theme.font_size_14

            font.weight: Font.Medium
        }

        Item {
            Layout.fillWidth: true
        }
    }
}
